#include<iostream>
using namespace std;
#include<thread>
#include<mutex>
//
static int value = 0;
 static int mycount = 0;
 std::condition_variable printVariable;
 std::mutex mtx;
void waitPrint()
{
	for (;;)
	{
		std::this_thread::sleep_for(std::chrono::seconds(1));
		std::unique_lock<std::mutex> curlock(mtx);
		printVariable.wait(curlock, []() {return value > 200; });
		cout << "------waitPrint------:" << value << endl;

	}
	
}

void calcValue()
{
	while (true)
	{
		std::this_thread::sleep_for(std::chrono::seconds(2));	
		std::unique_lock<std::mutex> curlock(mtx);
		value += 50;
		cout << "count:" << mycount++ << " " << value << endl;
		
		printVariable.notify_one();
			
	}
}
int main(void)
{

	thread t1(waitPrint);
	thread t2(calcValue);

	t1.join();
	t2.join();


	return 0;
}